package top.melody.ecommerce.platform.init;

import top.melody.ecommerce.platform.api.domain.basedata.Region;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: blentle
 * @group: rd
 * @createdate: 2016/12/9 13:18
 * @mail: blentle.huan.ren@gmail.com
 * @description: Todo:有问题，将来改成Ehcache
 * @since:1.0
 */
public class EcommerceCache {

    private static final EcommerceCache cache = new EcommerceCache();

    private static Map<Integer,Region> regionMap = new HashMap<Integer,Region>();

    private EcommerceCache() {

    }

    public static EcommerceCache getInstance() {
        return cache;
    }

    public Region loadRegion(int regionId) {
        return regionMap.get(regionId);
    }

    public void putRegion2Cache(Region region) {
        regionMap.put(region.getRegionId(),region);
    }
}
